package auth

import (
	"context"
	"fmt"

	"mydemo/api/rewark/internal/svc"
	"mydemo/api/rewark/internal/types"

	"github.com/zeromicro/go-zero/core/logx"
)

type DecodeJwtLogic struct {
	logx.Logger
	ctx    context.Context
	svcCtx *svc.ServiceContext
}

func NewDecodeJwtLogic(ctx context.Context, svcCtx *svc.ServiceContext) *DecodeJwtLogic {
	return &DecodeJwtLogic{
		Logger: logx.WithContext(ctx),
		ctx:    ctx,
		svcCtx: svcCtx,
	}
}

func (l *DecodeJwtLogic) DecodeJwt(req *types.DecodeJwtInput) (resp *types.DecodeJwtOutput, err error) {
	msg := fmt.Sprintf("用户 %v , 验证通过", l.ctx.Value("username"))
	return &types.DecodeJwtOutput{
		Msg: msg,
	}, nil
}
